package com.croofr.dao.service.implementation.database;

import com.croofr.dao.service.Mapping;

import java.lang.reflect.Field;

/**
 * User: bednar
 * Date: Mar 28, 2010
 * Time: 11:08:07 AM
 */
public class DatabaseMapping implements Mapping
{
    @Override
    public Field getKeyField(Class persistentUnitClass)
    {
        return getField("id", persistentUnitClass);
    }

    @Override
    public Field getField(String fieldName, Class persistentUnitClass)
    {
        try
        {
            return persistentUnitClass.getDeclaredField(fieldName);
        }
        catch (NoSuchFieldException e)
        {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

        return null;
    }
}
